package algorithm.poj.p3000;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLDecoder;


/**
 * 分析：
 * 实现：
 * 经验：
 * 教训：
 * 
 * @author wong.tong@gmail.com
 *
 */
public class P3096 {

	public static void main(String[] args) throws Exception {

		InputStream input = null;
		if (false) {
			input = System.in;
		} else {
			URL url = P3096.class.getResource("P3096.txt");
			File file = new File(URLDecoder.decode(url.getPath(), "UTF-8"));
			input = new FileInputStream(file);
		}
		
		BufferedReader stdin = new BufferedReader(new InputStreamReader(input));

		String line = stdin.readLine();
		while (line != null && !"*".equals(line.trim())) {
			if (check(line.toCharArray())){
				System.out.println(line + " is surprising.");
			} else {
				System.out.println(line + " is NOT surprising.");
			}
			line = stdin.readLine();
		}
	}

	private static boolean check(char[] cs) {
		
		if (cs.length < 2) return true;
		for (int D = 0; D < cs.length; D ++) {
			if (!check(cs, D)) return false;
		}
		return true;
	}

	private static boolean check(char[] cs, int D) {
		
		for (int i = 0; i < cs.length-D-1; i ++) {
			for (int j = 0; j < i; j ++) {
				if (cs[i] == cs[j] && cs[i+D+1] == cs[j+D+1]) {
					return false;
				}
			}
		}
		return true;
	}

}